home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Modem / LineShare⁄ZyXEL Folder / ZyXEL Fax&ARA next >
Text File  |  1992-12-25  |  6KB  |  270 lines

  1. !
  2. ! LineShare™ Script for ZyXEL U-1496 data-fax modems
  3. !
  4. ! If you want to modify this script for your modem, pay attention to
  5. ! the line marked "#### Settings ####" - it should be modified first
  6. ! This script is written to use with ARA on the "Data" subPort, so
  7. ! the modem is set to the "no correction/compression" mode
  8. !
  9.  
  10. ! ------------------------------------------
  11. ! Resetting the modem:
  12. ! ------------------------------------------
  13. @Hangup
  14.   SetTries 2
  15.   Flush
  16.   HsReset 0,0,17,19,0,0
  17. !
  18. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  19. ! to enter the command mode
  20. !
  21. @Label 1
  22.   matchclr
  23.   matchstr 1 2 "OK\r\n"
  24.   write "ATH0&F\r"
  25.   matchread 20
  26.   Write "+++"
  27.   DtrClear
  28.   pause 10
  29.   DtrSet
  30. !
  31.   DecTries
  32.   IfTries 0 1
  33. !
  34. ! OSErr -6019 "Modem error - the modem is not responding"
  35. !
  36.   exit -6019
  37. @Label 2
  38.   write "AT+FCLASS=0\r"
  39.   Jsr 100
  40.   write "AT+FAA=0\r"
  41.   Jsr 100
  42.   exit 0
  43. ! ------------------------------------------
  44. !    Receiving incoming calls
  45. ! ------------------------------------------
  46. @ANSWER
  47. @Label 10
  48. !
  49. ! Set the modem preferred speed first
  50. !
  51.   SERRESET 2400,0,8,1
  52.   Jsr 80
  53. !
  54. ! Set the common options
  55.   Jsr 70
  56. !
  57. ! Set the communication options:
  58. ! • X4:  Extended response set
  59. ! • &K0: Direct connection (no compression, correction - for ARA)
  60. ! • &M2 - disable buffering, &B0 - adjust the speed.
  61. ! • &H4: Xon/Xoff flow control (for Fax)
  62. !
  63. @Label 11
  64. ! #### Settings - change this according to the type of modem you have ####
  65.   Write "ATX4&K0&B0&M2&H4\r"
  66.   Jsr 100
  67. !
  68. ! Set the "work" speed
  69. !
  70. @Label 12
  71.   SERRESET 19200,0,8,1
  72.   Jsr 80
  73. !
  74. ! Set Fax parameters: LID, DCC,BOR
  75. !
  76.   Write "AT+FCLASS=2\r"
  77.   Jsr 100
  78.   Write "AT+FLID=\"Stalker_GmbH\"\r"
  79.   Jsr 100
  80.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  81.   Jsr 100
  82.   Write "AT+FBOR=1\r"
  83.   Jsr 100
  84. !
  85. ! Allow modem to receive fax messages
  86. !
  87.   Write "AT+FCR=1\r"
  88.   Jsr 100
  89. !
  90. ! Tell the modem to determine the type of the incoming call
  91. ! Fetch the tube after N rings, where N has been set in the control panel (^4)
  92. !
  93.   Write "ATS0=^4+FAA=1\r"
  94.   Jsr 100
  95. !
  96. ! Everything is ready - let's sit and wait for a call
  97. ! We'll wait for 2 minutes, then reinitiate the modem
  98. !
  99. @Label 20
  100.   MatchClr
  101.   matchstr 1 20 "RING\r\n"
  102.   matchstr 2 21 "\r\nCONNECT"
  103.   matchstr 3 24 "\r\n+FCON"
  104.   matchstr 4 10 "\r\nNO "
  105.   matchstr 5 10 "\r\nBUSY"
  106.   Matchread 1200
  107.   jump 10
  108. !
  109. ! Data connection has been established (we read "CONNECT")
  110. ! Put the "CONNECT" back to the buffer and attach the "Data" subPort
  111. ! if it was an incoming call, put the "RING" before the "CONNECT"
  112. !
  113. @Label 21
  114.   LogMsg "Data call…"
  115.   QueueInput "\r\nCONNECT"
  116.   ifOriginate 22
  117.   QueueInput "\r\nRING\r\n"
  118. @Label 22
  119.   Attach "Data" (DTR,Escape,TimeLimit=0)
  120. !
  121. ! Fax connection has been established (we read "+FCON")
  122. ! Put the +FCON back to the buffer,
  123. ! if it was an incoming call, put the "RING" before the "+FCON"
  124. ! Attach the "Fax" subPort
  125. !
  126. @Label 24
  127.   QueueInput "\r\n+FCON"
  128.   ifOriginate 25
  129.   QueueInput "\r\nRING\r\n"
  130. @Label 25
  131.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  132. ! ------------------------------------------
  133. ! Originating a call through the "Data" subport
  134. ! ------------------------------------------
  135. @ORIGINATE "Data"
  136. !
  137. ! Set the Data speed
  138. !
  139.   SERRESET 19200,0,8,1
  140.   Jsr 80
  141. !
  142. ! Set the common options
  143. !
  144.   Jsr 70
  145. !
  146. ! Set the Data mode:
  147. ! • X4:  Extended response set
  148. ! • &K0: Direct connection (no compression, correction - for ARA)
  149. ! • &M2 - disable buffering, &B0 - adjust the speed.
  150. ! • &S1: DSR according to CCITT (if the cable connects CTS with DSR, not DCD)
  151. ! • S7:  time-out (90 sec) for long-distance call (if you use them)
  152. !
  153. ! #### Settings - change this according to the type of modem you have ####
  154.   Write "ATX4&K0&M2&B0&S1S7=90\r"
  155.   Jsr 100
  156. !
  157. ! Now emit all commands that the application has sent to that port
  158. ! (if we use ARA/LineShare script, no commands were sent)
  159. !
  160.   Jsr 60
  161. !
  162. ! Prepare to receive all error result codes
  163. !
  164.   Jsr 90
  165.   matchstr 1 21 "\r\nCONNECT"
  166. !
  167. ! Dial the number
  168. !
  169.   HsReset *
  170.   Write "ATD^1\r"
  171.   MatchRead 900
  172.   Write "\r"
  173.   Exit -6019
  174. ! ------------------------------------------
  175. ! Originating a call through the "Fax" subPort
  176. ! ------------------------------------------
  177. @ORIGINATE "Fax" ("\r\nLineShare Line is Busy\r\nNO DIALTONE\r\n")
  178. !
  179. ! Set the "Fax" speed
  180. !
  181.   SERRESET 19200,0,8,1
  182.   Jsr 80
  183. !
  184. ! Set the common options
  185. !
  186.   Jsr 70
  187. !
  188. ! Set the Fax mode
  189. ! &S0: DSR always on (see above)
  190. !
  191.   Write "AT&S0+FCLASS=2\r"
  192.   Jsr 100
  193. !
  194. ! Now emit all commands that the application has sent to that port,
  195. ! Prepare to receive all error result codes
  196. !
  197. @LABEL 50
  198.   Jsr 60
  199.   Jsr 90
  200.   MatchStr 1 24 "\r\n+FCON"
  201.   HsReset *
  202.   Write "ATD^1\r"
  203.   MatchRead 700
  204.   Write "\r"
  205.   Exit -6019
  206. !
  207. ! This section emits all modem commands sent from the client application
  208. ! For each set of commands the "OK" answer is awaited
  209. !
  210. @Label 60
  211.   EmitStart
  212. @Label 61
  213.   EmitCommand 62
  214.   Jsr 100
  215.   Jump 61
  216. @Label 62
  217.   return
  218. !
  219. ! This section initiates the modem before ANSWER and ORIGINATEs:
  220. ! factory settings + speaker control +
  221. ! reset on Dtr drop + DCD valid
  222. ! Verbal responses mode, no echo 
  223. !
  224. @Label 70
  225.   Write "ATM^2L^3&D3&C1V1E0\r"
  226.   Jsr 100
  227.   return 
  228. !
  229. ! This section syncronize the modem after the serial port speed switching
  230. !
  231. @Label 80
  232.   ChrDelay 1
  233.   Write "AT\r"
  234.   ChrDelay 0
  235.   Jsr 100
  236.   return
  237. !
  238. ! Prepare to receive error result codes
  239. !
  240. @Label 90
  241.   MatchClr
  242.   MatchStr 2 91 "NO DIALTONE\r\n"
  243.   MatchStr 3 92 "BUSY\r\n"
  244.   MatchStr 4 93 "NO CARRIER\r\n"
  245.   MatchStr 5 94 "NO ANSWER\r\n"
  246.   return
  247. @Label 91
  248.   exit -6020
  249. @Label 92
  250.   exit -6022
  251. @Label 93
  252.   exit -6021
  253. @Label 94
  254.   exit -6023
  255. !
  256. ! Processing the AT command:
  257. ! OK -> proceed
  258. ! ERROR or TimeOut ->exit -6019
  259. ! It can be called AFTER the "Write" command, since LineShare buffers input
  260. !
  261. @Label 100
  262.   MatchClr
  263.   MatchStr 1 102 "\r\nOK\r\n"
  264.   MatchStr 2 101 "\r\nERROR\r\n"
  265.   MatchRead 20
  266. @Label 101
  267.   Exit -6019
  268. @Label 102
  269.   return
  270.